-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Python DownloadProgress void* mappings #1769
base: main
Are you sure you want to change the base?
Implement Python DownloadProgress void* mappings #1769
Conversation
Tested with the following test program: #!/usr/bin/python3
import libdnf5
class DownloadProgress(libdnf5.repo.DownloadCallbacks):
def add_new_download(self, user_data, description, total_to_download):
print("Just added package %s to download list" % description)
return description
def progress(self, user_cb_data, total_to_download, downloaded):
print(f"progress achieved on {user_cb_data}")
return 0
def end(self, user_cb_data, status, msg):
print(f"download ended for {user_cb_data}, with status={status} and msg={msg}")
return 0
base = libdnf5.base.Base()
base.load_config()
base.setup()
sack = base.get_repo_sack()
sack.create_repos_from_system_configuration()
sack.update_and_load_enabled_repos(True)
goal = libdnf5.base.Goal(base)
goal.add_rpm_upgrade()
transaction = goal.resolve()
downloader_callbacks = DownloadProgress()
base.set_download_callbacks(
libdnf5.repo.DownloadCallbacksUniquePtr(downloader_callbacks)
)
transaction.download()
print("Done downloading") I get:
|
Hi. Thank you for your work. I'm working on that too. I'm looking for a solution that would work correctly with memory and I need to solve all the languages supported by the libdnf5 project - Python, Ruby, Perl. I am considering whether there is a need to store objects in a helper container. I looked at your code. I see you are dealing with Python and storing objects. You use |
This is probably not the right way to do it, or it may not even be complete. But I just want to help to move along the issue I filled and contribute back. Hopefully it will help a maintainer to get started.
Fixes #1441